<?php
/**
* 单页处理
*/

namespace Assist\Controller;

class PageController extends AssistController {
    public function _empty($name){
        $category = D('Category')->info('page');
        if($category && 1 == $category['status']){
            switch ($category['display']) {
                case 0:
                    $this->error('该分类禁止显示！');
                    break;
                default:
                    break;
            }
        } else {
            $this->error('分类不存在或被禁用！');
        }
        if($name==zb){
            $Document = D('Document');
            $map['name']="profile";
            $map['category_id'] = $category['id'];
            $map['status'] = 1;
            $doc = $Document->where($map)->find();
            if($doc){
                $docDetail = $Document->detail($doc['id']);
                $this->assign('doc',$docDetail);
                $this->display('index');
            }else{
                $this->error('文档不存在或已禁用！');
            }
        }else {
            $Document = D('Document');
            $map['name'] = $name;
            $map['category_id'] = $category['id'];
            $map['status'] = 1;
            $doc = $Document->where($map)->find();
            if($doc){
                $docDetail = $Document->detail($doc['id']);
                $this->assign('doc',$docDetail);
                $this->display('index');
            }else{
                $this->error('文档不存在或已禁用！');
            }
        }
       
    }
}